19. Lab IV: Build a Dog GraphQL API (Testing)

Lab: Build a Dog GraphQL API

Here, we'll finish off this lesson's lab, creating a GraphQL API that returns a list of dogs from an embedded H2 in memory database. This time, you'll create a .sql file for some example dog data, and then test that everything with the API is working correctly.

Testing

You can re-use your previous data.sql file from the last lesson for Step 1, or you can create a new one.

  • Step 1: Create a data.sql file to create sample dog data in the database.

  • Step 2: Check that you are able to access your API, and that GraphQL queries work appropriately.

    • If you have been following the solutions so far, note that @SpringBootTest might not play well with your application by default, but that the application should be able to boot on its own still.

Build a Dog GraphQL API Lab

Task List:

Task Feedback:

Amazing! You've now built both a REST API and a GraphQL API for a dog database. In the next lesson, you'll also build a similar microservice.